<template>
  <div class="fire-container">
    <div class="fire-main-container">
      <div class="fire-main">
        <div class="form-title">
          {{ props.waterData.menuName }}
        </div>
        <div :class="getmargin()">
          <el-form
            ref="ruleFormRef"
            :inline="true"
            style="padding: 0 10px"
            :model="xfbfxxData"
            label-width="80px"
            class="demo-ruleForm"
            :size="formSize"
            status-icon
          >
            <div v-if="props.waterData.orderId == '1' || props.waterData.orderId == '2'">
              <el-form-item
                v-if="props.waterData.orderId == '1'"
                label="名称"
                prop="xfsgwmc"
                class="mingcheng"
              >
                <el-input v-model.trim="xfbfxxData.xfsgwmc" placeholder="请输入名称" />
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '2'"
                label="名称"
                prop="xfpmgwmc"
                class="mingcheng"
              >
                <el-input v-model.trim="xfbfxxData.xfpmgwmc" placeholder="请输入名称" />
              </el-form-item>
              <el-form-item label="主管管径" prop="zgzj" class="">
                <el-input v-model.trim="xfbfxxData.zgzj" placeholder="请输入主管管径"> </el-input>
                <span
                  style="
                    position: absolute;
                    top: -6px;
                    right: 0;
                    display: table-cell;
                    white-space: nowrap;
                    padding: 7px 10px;
                  "
                  >mm</span
                >
              </el-form-item>
              <el-form-item label="类型" prop="gwlx" class="">
                <el-select v-model="xfbfxxData.gwlx" placeholder="请选择类型">
                  <el-option
                    v-for="item in sgoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="稳压压力" prop="gwwyyl" class="">
                <el-input v-model.trim="xfbfxxData.gwwyyl" placeholder="请输入稳压压力" />
                <span
                  style="
                    position: absolute;
                    top: -6px;
                    right: 0;
                    display: table-cell;
                    white-space: nowrap;
                    padding: 7px 10px;
                  "
                  >MPa</span
                >
              </el-form-item>
              <el-form-item label="高压压力" prop="gwgyyl" class="">
                <el-input v-model.trim="xfbfxxData.gwgyyl" placeholder="请输入高压压力" />
                <span
                  style="
                    position: absolute;
                    top: -6px;
                    right: 0;
                    display: table-cell;
                    white-space: nowrap;
                    padding: 7px 10px;
                  "
                  >MPa</span
                >
              </el-form-item>
            </div>
            <div v-if="props.waterData.orderId == '3' || props.waterData.orderId == '4'">
              <div class="card-item-title">基本信息</div>
              <el-form-item
                v-if="props.waterData.orderId == '3'"
                label="名称"
                prop="xfbfmc"
                class=""
              >
                <el-input v-model.trim="xfbfxxData.xfbfmc" placeholder="请输入名称" />
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '4'"
                label="名称"
                prop="pmzmc"
                class=""
              >
                <el-input v-model.trim="xfbfxxData.pmzmc" placeholder="请输入名称" />
              </el-form-item>
              <el-form-item label="使用状态" prop="syzt" class="">
                <el-select v-model="xfbfxxData.syzt">
                  <el-option
                    v-for="item in syztoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '3'"
                label="位置说明"
                class="mingcheng"
                prop="wzsm"
              >
                <el-input v-model.trim="xfbfxxData.wzsm" placeholder="请输入位置说明" />
              </el-form-item>
              <el-form-item label="管控范围" class="mingcheng" prop="gkfw">
                <el-input v-model.trim="xfbfxxData.gkfw" placeholder="请输入管控范围" />
              </el-form-item>
              <div v-if="props.waterData.orderId == '3'" class="card-item-title">联系人信息</div>
              <div v-if="props.waterData.orderId == '3'" style="margin: 0 0 10px 20px" class="">
                消防泵房负责人
              </div>
              <div v-if="props.waterData.orderId == '3'">
                <div class="personInCharge">
                  <el-form-item label="姓名" prop="fzrxxInfo.rymc" label-width="50px">
                    <el-input v-model.trim="xfbfxxData.fzrxxInfo.rymc" placeholder="请输入姓名" />
                  </el-form-item>
                  <el-form-item label="手机" label-width="50px" prop="fzrxxInfo.ryyddh">
                    <el-input v-model.trim="xfbfxxData.fzrxxInfo.ryyddh" placeholder="请输入手机" />
                  </el-form-item>
                  <el-form-item label="值班电话" prop="fzrxxInfo.ryzbdh">
                    <el-input
                      v-model.trim="xfbfxxData.fzrxxInfo.ryzbdh"
                      placeholder="请输入值班电话"
                    />
                  </el-form-item>
                </div>
                <div class="firePump pmjPump">
                  <div class="border-box">
                    <div class="border-left"></div>
                    <div class="border-content">消防泵</div>
                    <div class="border-right"></div>
                  </div>
                  <el-table
                    class="tablebox"
                    :data="xfbfxxData.xfbxxInfoList&&xfbfxxData.xfbxxInfoList.filter((val:any)=>val.sfyx != 0)"
                    style="width: 100%"
                    height="200"
                    :header-cell-style="{
                      background: 'rgba(1, 7, 17, 0.8)',
                      color: 'rgba(255, 255, 255, 1)',
                    }"
                  >
                    <el-table-column
                      type="index"
                      label="序号"
                      width="55"
                      header-align="center"
                      align="center"
                    ></el-table-column
                    >/>
                    <el-table-column label="泵类型">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'xfbxxInfoList.' + scope.$index + '.blx'"
                        >
                          <el-select v-model="scope.row.blx">
                            <el-option
                              v-for="item in blxoptions"
                              :key="item.zddm"
                              :label="item.zdmc"
                              :value="item.zddm"
                            />
                          </el-select>
                        </el-form-item>
                        <span v-else>{{ formatBlx(scope.row) }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="泵扬程（m）">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'xfbxxInfoList.' + scope.$index + '.byc'"
                        >
                          <el-input v-model.trim="scope.row.byc" type="text"></el-input>
                        </el-form-item>
                        <span v-else>{{ scope.row.byc }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="泵流量（L/s）">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'xfbxxInfoList.' + scope.$index + '.bll'"
                        >
                          <el-input v-model.trim="scope.row.bll" type="text"></el-input>
                        </el-form-item>
                        <span v-else>{{ scope.row.bll }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="动力形式">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'xfbxxInfoList.' + scope.$index + '.dlxs'"
                        >
                          <el-select v-model="scope.row.dlxs">
                            <el-option
                              v-for="item in dllxoptions"
                              :key="item.zddm"
                              :label="item.zdmc"
                              :value="item.zddm"
                            />
                          </el-select>
                        </el-form-item>
                        <span v-else>{{ formatDlxs(scope.row) }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="使用模式">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'xfbxxInfoList.' + scope.$index + '.syms'"
                        >
                          <el-select v-model="scope.row.syms">
                            <el-option
                              v-for="item in symsoptions"
                              :key="item.zddm"
                              :label="item.zdmc"
                              :value="item.zddm"
                            />
                          </el-select>
                        </el-form-item>
                        <span v-else>{{ formatSyms(scope.row) }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" width="80" header-align="center" align="center">
                      <template #default="scope">
                        <div style="display: flex; justify-content: center">
                          <div
                            v-if="!scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer"
                            @click="editClick(scope.row, 1)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/编辑.png"
                              alt=""
                            />
                          </div>
                          <div
                            v-if="scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer"
                            @click="subClick(scope.row)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/保存.png"
                              alt=""
                            />
                          </div>
                          <div
                            v-if="!scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer; margin-left: 5px"
                            @click="deleteClick(scope.row, 2, scope.$index)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/删除.png"
                              alt=""
                            />
                          </div>
                        </div>
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </div>
              <div v-if="props.waterData.orderId == '4'">
                <div class="firePump pmjPump">
                  <div class="firePump-text-left"></div>
                  <span class="firePump-text">泡沫剂</span>
                  <div class="firePump-text-right"></div>
                  <el-table
                    :data="xfbfxxData.pmjxxInfoList&&xfbfxxData.pmjxxInfoList.filter((val:any)=>val.sfyx != 0)"
                    style="width: 100%"
                    :header-cell-style="{
                      background: ' rgba(1, 7, 17, 0.8);',
                      color: 'rgba(255, 255, 255, 1)',
                    }"
                  >
                    <el-table-column
                      type="index"
                      label="序号"
                      width="55"
                      header-align="center"
                      align="center"
                    ></el-table-column
                    >/>
                    <el-table-column label="泡沫剂名称" width="200">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmjxxInfoList.' + scope.$index + '.pmzmc'"
                        >
                          <el-input v-model.trim="scope.row.pmzmc" type="text"></el-input>
                        </el-form-item>
                        <span v-else>{{ scope.row.pmzmc }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="比例" width="90">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmjxxInfoList.' + scope.$index + '.pmyjbl'"
                        >
                          <el-input v-model.trim="scope.row.pmyjbl" type="text"></el-input>
                          <span
                            style="
                              position: absolute;
                              top: -6px;
                              right: 0;
                              display: table-cell;
                              white-space: nowrap;
                              padding: 7px 10px;
                            "
                            >%</span
                          >
                        </el-form-item>
                        <span v-else>{{ scope.row.pmyjbl }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="最大存储容量（t）" width="80px">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmjxxInfoList.' + scope.$index + '.zdccrl'"
                        >
                          <el-input v-model.trim="scope.row.zdccrl" type="text"></el-input>
                        </el-form-item>
                        <span v-else>{{ scope.row.zdccrl }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="泡沫比例混合器形式" width="150px">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmjxxInfoList.' + scope.$index + '.pmblhhqxs'"
                        >
                          <el-select v-model="scope.row.pmblhhqxs" placeholder="请选择使用状态">
                            <el-option
                              v-for="item in pmblhhoptions"
                              :key="item.zddm"
                              :label="item.zdmc"
                              :value="item.zddm"
                            />
                          </el-select>
                        </el-form-item>
                        <span v-else>{{ formatPmblhhq(scope.row) }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" header-align="center" align="center">
                      <template #default="scope">
                        <div style="display: flex; justify-content: center">
                          <div
                            v-if="!scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer"
                            @click="pmeditClick(scope.row)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/编辑.png"
                              alt=""
                            />
                          </div>
                          <div
                            v-if="scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer"
                            @click="pmsubClick(scope.row)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/保存.png"
                              alt=""
                            />
                          </div>
                          <div
                            v-if="!scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer; margin-left: 5px"
                            @click="pmsdeleteClick(scope.row, 2, scope.$index)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/删除.png"
                              alt=""
                            />
                          </div>
                        </div>
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
                <div class="firePump pmjPump" style="margin-top: 20px">
                  <div class="firePump-text-left"></div>
                  <span class="firePump-text">泡沫泵</span>
                  <div class="firePump-text-right"></div>
                  <el-table
                    :data="xfbfxxData.pmzbxxInfoList&&xfbfxxData.pmzbxxInfoList.filter((val:any)=>val.sfyx != 0)"
                    style="width: 100%"
                    :header-cell-style="{
                      background: 'rgba(1, 7, 17, 0.8)',
                      color: 'rgba(255, 255, 255, 1)',
                    }"
                  >
                    <el-table-column
                      type="index"
                      label="序号"
                      width="55"
                      header-align="center"
                      align="center"
                    ></el-table-column
                    >/>
                    <el-table-column label="泵类型">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmzbxxInfoList.' + scope.$index + '.blx'"
                        >
                          <el-select v-model="scope.row.blx">
                            <el-option
                              v-for="item in blxoptions"
                              :key="item.zddm"
                              :label="item.zdmc"
                              :value="item.zddm"
                            />
                          </el-select>
                        </el-form-item>
                        <span v-else>{{ formatBlx(scope.row) }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="泵扬程（m">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmzbxxInfoList.' + scope.$index + '.byc'"
                        >
                          <el-input v-model.trim="scope.row.byc" type="text"></el-input>
                        </el-form-item>
                        <span v-else>{{ scope.row.byc }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="泵流量（L/s">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmzbxxInfoList.' + scope.$index + '.bll'"
                        >
                          <el-input v-model.trim="scope.row.bll" type="text"></el-input>
                        </el-form-item>
                        <span v-else>{{ scope.row.bll }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="动力形式">
                      <template #default="scope">
                        <el-form-item
                          v-if="scope.row.show"
                          :prop="'pmzbxxInfoList.' + scope.$index + '.dlxs'"
                        >
                          <el-select v-model="scope.row.dlxs">
                            <el-option
                              v-for="item in dllxoptions"
                              :key="item.zddm"
                              :label="item.zdmc"
                              :value="item.zddm"
                            />
                          </el-select>
                        </el-form-item>
                        <span v-else>{{ formatDlxs(scope.row) }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" width="80" header-align="center" align="center">
                      <template #default="scope">
                        <div style="display: flex; justify-content: center">
                          <div
                            v-if="!scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer"
                            @click="pmbeditClick(scope.row)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/编辑.png"
                              alt=""
                            />
                          </div>
                          <div
                            v-if="scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer"
                            @click="pmbsubClick(scope.row)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/保存.png"
                              alt=""
                            />
                          </div>
                          <div
                            v-if="!scope.row.show"
                            style="width: 20px; height: 20px; cursor: pointer; margin-left: 5px"
                            @click="pmbdeleteClick(scope.row, 2, scope.$index)"
                          >
                            <img
                              style="width: 100%; height: 100%"
                              src="/src/assets/image/fire/删除.png"
                              alt=""
                            />
                          </div>
                        </div>
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </div>
            </div>
            <div
              v-if="props.waterData.orderId == '5' || props.waterData.orderId == '6'"
              class="xfsy"
            >
              <el-form-item label="名称" prop="symc" class="zdccmingcheng1">
                <el-input v-model.trim="xfbfxxData.symc" placeholder="请输入名称" />
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '6'"
                label="水系类型"
                prop="sxlx"
                class="sx-box"
              >
                <el-select v-model="xfbfxxData.sxlx" placeholder="请选择类型">
                  <el-option
                    v-for="item in sxlxoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '5'"
                class="zdcclbox"
                label="存储形式"
                prop="ccxs"
              >
                <el-select v-model="xfbfxxData.ccxs">
                  <el-option
                    v-for="item in ccxsoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '5'"
                class="zdcclbox"
                label="最大存储容量"
                prop="zdccrl"
              >
                <el-input v-model.trim="xfbfxxData.zdccrl" placeholder="请输入名称" />
                <span
                  style="
                    position: absolute;
                    top: -6px;
                    right: 0;
                    display: table-cell;
                    white-space: nowrap;
                    padding: 7px 10px;
                  "
                  >m³</span
                >
              </el-form-item>
            </div>
            <div v-if="props.waterData.orderId == '7' || props.waterData.orderId == '8'">
              <el-form-item v-if="props.waterData.orderId != '10'" label="类型" prop="lx" class="">
                <el-select v-model="xfbfxxData.lx">
                  <el-option
                    v-for="item in xhslxoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <!-- <el-form-item
                v-if="props.waterData.orderId == '8'"
                label="泡沫栓口径"
                label-width="100"
                prop="pmskj"
              >
                <el-input v-model.trim="xfbfxxData.pmskj" />
                <span
                  style="
                    position: absolute;
                    top: -6px;
                    right: 0;
                    display: table-cell;
                    white-space: nowrap;
                    padding: 7px 10px;
                  "
                  >mm</span
                >
              </el-form-item> -->
              <el-form-item
                v-if="props.waterData.orderId == '7' || props.waterData.orderId == '10'"
                label="介质"
                prop="jz"
                class=""
              >
                <el-select v-model="xfbfxxData.jz">
                  <el-option
                    v-for="item in jzoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '7'"
                label="所属管网"
                prop="xfsgwid"
                class=""
              >
                <el-select v-model="xfbfxxData.xfsgwid">
                  <el-option
                    v-for="item in dataList"
                    :key="item.id"
                    :label="item.xfsgwmc ? item.xfsgwmc : ' '"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '8'"
                label="所属管网"
                prop="xfpmgwid"
                class=""
              >
                <el-select v-model="xfbfxxData.xfpmgwid">
                  <el-option
                    v-for="item in pmsOptions"
                    :key="item.id"
                    :label="item.xfpmgwmc ? item.xfpmgwmc : ' '"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
              <!-- <el-form-item
                v-if="props.waterData.orderId == '7'"
                label="消火栓口径"
                class="xhskj"
                prop="xhskj"
              >
                <el-input v-model.trim="xfbfxxData.xhskj" placeholder="请输入">
                  <template #suffix>
                    <i style="font-style: normal">mm</i>
                  </template>
                </el-input>
              </el-form-item> -->
            </div>
            <div v-if="props.waterData.orderId == '9' || props.waterData.orderId == '10'">
              <el-form-item v-if="props.waterData.orderId == '9'" label="介质" prop="jz" class="">
                <el-select v-model="xfbfxxData.jz">
                  <el-option
                    v-for="item in jzoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '9'"
                label="所属管网"
                prop="xfsgwid"
                class=""
              >
                <el-select v-model="xfbfxxData.xfsgwid">
                  <el-option
                    v-for="item in dataList"
                    :key="item.id"
                    :label="item.xfsgwmc ? item.xfsgwmc : ' '"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
              <el-form-item v-if="props.waterData.orderId == '10'" label="介质" prop="jz" class="">
                <el-select v-model="xfbfxxData.jz">
                  <el-option
                    v-for="item in jzoptions"
                    :key="item.zddm"
                    :label="item.zdmc"
                    :value="item.zddm"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                v-if="props.waterData.orderId == '10'"
                label="所属管网"
                prop="xfpmgwid"
                class=""
              >
                <el-select v-model="xfbfxxData.xfpmgwid">
                  <el-option
                    v-for="item in pmsOptions"
                    :key="item.id"
                    :label="item.xfpmgwmc ? item.xfpmgwmc : ' '"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div style="text-align: center; margin-bottom: 25px; margin-top: 25px">
          <el-button type="info" style="border-radius: 10px" @click="cancelClick">取消</el-button>
          <el-button
            type="info"
            style="margin: 0 64px; border-radius: 10px"
            @click="removeClick(ruleFormRef)"
            >重置
          </el-button>
          <el-button
            type="success"
            style="background: #02979b; border-radius: 10px"
            @click="submit(ruleFormRef)"
            >保存
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import DialogPopUp from '@/components/DialogPopUp/index.vue'
import type { FormRules, FormInstance } from 'element-plus'
import {
  upDateXfbfxx,
  upDatepmz,
  upDatexfsy,
  upDatezrsy,
  upDatxfsgwxx,
  upDatxfpaomgw,
  queryZdZdmcInfo,
  upDatxhs,
  queryxfsgwdd,
  upDatpms,
  upDatgdsp,
  upDatgdpmp,
} from '@/service/api'
import xfbf_icon from '@/assets/image/MapIcon/xfbf-icon.png'
import pmz_icon from '@/assets/image/MapIcon/pmz-icon.png'
import xfsy_icon from '@/assets/image/MapIcon/xfsy-icon.png'
import trsy_icon from '@/assets/image/MapIcon/trsy-icon.png'
import { ElMessage } from 'element-plus'
import xhs_icon from '@/assets/image/MapIcon/xhs-icon.png'
import pms_icon from '@/assets/image/MapIcon/pms-icon.png'
import gdsp_icon from '@/assets/image/MapIcon/gdsp-icon.png'
import gdpmp_icon from '@/assets/image/MapIcon/gdpmp-icon.png'
import { createOverlay, createPoint } from '@/utils/common/createMapFactor'
import { usezhezaocStore, useChemicalStore } from '@/store'
import { checkNumberTypeAndLength } from '@/utils/common'
const chemicalStore = useChemicalStore()
const data = usezhezaocStore()
//获取企业id
const qyId = computed(() => {
  return chemicalStore.qyInfo.id
})
const props = defineProps<{
  waterData: any
  dianweiList: any
  blxoptions: any
  dllxoptions: any
  symsoptions: any
  pmblhhoptions: any
  lastxfs: any
  lastpms: any
  lastgdsp: any
  lastgdpmp: any
}>()

// const prop = defineProps({
//   lastpms: {
//     type: Object,
//     default: () => {
//       return {}
//     },
//   },
// })

const sgoptions = ref()
const xfbfxxData = ref({
  xfsgwmc: '',
  xfpmgwmc: '',
  qyid: qyId.value,
  zgzj: '',
  gwlx: '',
  gwwyyl: '',
  gwgyyl: '',
  xfbfmc: '',
  pmzmc: '',
  syzt: '',
  wzsm: '',
  gkfw: '',
  symc: '',
  sxlx: '',
  ccxs: '',
  zdccrl: '',
  lx: '',
  pmskj: '',
  jz: '',
  sfyx: 1,
  xfsgwid: '',
  xfpmgwid: '',
  xhskj: '',
  id: '',
  wzxxbInfo: {},
  fzrxxInfo: {
    rymc: '',
    ryyddh: '',
    ryzbdh: '',
    rysx: 0,
    sfyx: 1,
    qyid: qyId.value,
  },
  xfbxxInfoList: [
    {
      blx: props.blxoptions ? props.blxoptions[0].zddm : '',
      byc: '',
      bll: '',
      dlxs: props.dllxoptions ? props.dllxoptions[0].zddm : '',
      syms: props.symsoptions ? props.symsoptions[0].zddm : '',
      sfyx: 1,
      sfbj: 0,
      qyid: props.dianweiList ? props.dianweiList.qyid : '',
      xfbfid: '',
      show: true,
    },
  ],
  pmjxxInfoList: [
    {
      pmzmc: '',
      pmyjbl: '',
      zdccrl: '',
      pmzid: '',
      sfyx: 1,
      sfbj: 0,
      qyid: props.dianweiList ? props.dianweiList.qyid : '',
      show: true,
      pmblhhqxs: props.pmblhhoptions ? props.pmblhhoptions[0].zddm : '',
    },
  ],
  pmzbxxInfoList: [
    {
      blx: props.blxoptions ? props.blxoptions[0].zddm : '',
      byc: '',
      bll: '',
      dlxs: props.dllxoptions ? props.dllxoptions[0].zddm : '',
      pmzid: '',
      sfyx: 1,
      sfbj: 0,
      qyid: props.dianweiList ? props.dianweiList.qyid : '',
      show: true,
    },
  ],
})

// const blxoptions = ref()
// const dllxoptions = ref()
// const symsoptions = ref()
const syztoptions = ref()
// const pmblhhoptions = ref()
const ccxsoptions = ref()
const sxlxoptions = ref()
const xhslxoptions = ref()
const jzoptions = ref()
const pmsOptions = ref()
const ruleFormRef = ref<FormInstance>()
const dataList = ref()
const emit = defineEmits(['cancelClick', 'updateList'])
const formSize = ref('default')

watch(
  () => xfbfxxData.value.sxlx,
  (newVal, oldVal) => {
    if (typeof xfbfxxData.value.sxlx === 'number') {
      xfbfxxData.value.sxlx = xfbfxxData.value.sxlx + ''
    }
  }
)

function cancelClick() {
  chemicalStore.tipsPageShow = false //关闭提示标牌
  emit('cancelClick')
}
const type = ref()

function editClick(item: any, types: any) {
  type.value = types
  item.show = true
  item.sfbj = 1
  if (item.show === true && item.sfbj === 1) {
    props.blxoptions?.forEach((res: any) => {
      if (res.zddm == item.blx) {
        item.blx = res.zdmc
      }
    })

    props.dllxoptions?.forEach((res: any) => {
      if (res.zddm == item.dlxs) {
        item.dlxs = res.zdmc
      }
    })

    props.symsoptions?.forEach((res: any) => {
      if (res.zddm == item.syms) {
        item.syms = res.zdmc
      }
    })
  }
}
const firstblx: any = ref('')
function subClick(item: any) {
  if (item.byc && !checkNumberTypeAndLength(item.byc, '泵扬程', 6)) {
    return
  } else if (item.bll && !checkNumberTypeAndLength(item.bll, '泵流量', 6)) {
    return
  }
  if (item.sfbj === 1) {
    props.blxoptions?.forEach((res: any) => {
      if (res.zdmc == item.blx) {
        item.blx = res.zddm
      }
    })
    props.dllxoptions?.forEach((res: any) => {
      if (res.zdmc == item.dlxs) {
        item.dlxs = res.zddm
      }
    })

    props.symsoptions?.forEach((res: any) => {
      if (res.zdmc == item.syms) {
        item.syms = res.zddm
      }
    })
    item.show = false
    return
  }
  // firstblx.value = blxoptions.value
  item.show = false
  xfbfxxData.value.xfbxxInfoList.push({
    blx: props.blxoptions ? props.blxoptions[0].zddm : '',
    byc: '',
    bll: '',
    dlxs: props.dllxoptions ? props.dllxoptions[0].zddm : '',
    syms: props.symsoptions ? props.symsoptions[0].zddm : '',
    sfyx: 1,
    sfbj: 0,
    qyid: props.dianweiList ? props.dianweiList.qyid : '',
    xfbfid: props.dianweiList ? props.dianweiList.cjid : '',
    show: true,
  })
}

function pmeditClick(item: any) {
  item.show = true
  item.sfbj = 1
  if (item.show === true && item.sfbj === 1) {
    props.pmblhhoptions?.forEach((res: any) => {
      if (res.zddm == item.pmblhhqxs) {
        item.pmblhhqxs = res.zdmc
      }
    })
  }
}
function pmsubClick(item: any) {
  if (item.zdccrl && !checkNumberTypeAndLength(item.zdccrl, '最大存储容量', 8)) {
    return
  }
  if (item.sfbj === 1) {
    props.pmblhhoptions?.forEach((res: any) => {
      if (res.zdmc == item.pmblhhqxs) {
        item.pmblhhqxs = res.zddm
      }
    })
    item.show = false
    return
  }
  item.show = false
  xfbfxxData.value.pmjxxInfoList.push({
    pmzmc: '',
    pmyjbl: '',
    zdccrl: '',
    sfyx: 1,
    sfbj: 0,
    pmzid: props.dianweiList ? props.dianweiList.cjid : '',
    qyid: props.dianweiList ? props.dianweiList.qyid : '',
    show: true,
    pmblhhqxs: props.pmblhhoptions ? props.pmblhhoptions[0].zddm : '',
  })
}
function pmbeditClick(item: any) {
  item.sfbj = 1
  item.show = true
  if (item.show === true && item.sfbj === 1) {
    props.blxoptions?.forEach((res: any) => {
      if (res.zddm == item.blx) {
        item.blx = res.zdmc
      }
    })

    props.dllxoptions?.forEach((res: any) => {
      if (res.zddm == item.dlxs) {
        item.dlxs = res.zdmc
      }
    })
  }
}
function pmbsubClick(item: any) {
  if (item.byc && !checkNumberTypeAndLength(item.byc, '泵扬程', 6)) {
    return
  } else if (item.bll && !checkNumberTypeAndLength(item.bll, '泵流量', 6)) {
    return
  }
  if (item.sfbj === 1) {
    props.blxoptions?.forEach((res: any) => {
      if (res.zdmc == item.blx) {
        item.blx = res.zddm
      }
    })
    props.dllxoptions?.forEach((res: any) => {
      if (res.zdmc == item.dlxs) {
        item.dlxs = res.zddm
      }
    })
    item.show = false
    return
  }
  item.show = false
  xfbfxxData.value.pmzbxxInfoList.push({
    blx: props.blxoptions ? props.blxoptions[0].zddm : '',
    byc: '',
    bll: '',
    dlxs: props.dllxoptions ? props.dllxoptions[0].zddm : '',
    sfyx: 1,
    sfbj: 0,
    pmzid: props.dianweiList ? props.dianweiList.cjid : '',
    qyid: props.dianweiList ? props.dianweiList.qyid : '',
    show: true,
  })
}

//删除
function deleteClick(val: any, types: any, index: any) {
  if (val.id) {
    type.value = types
    xfbfxxData.value.xfbxxInfoList.map((item: any, index: any) => {
      if (val.id == item.id) {
        item.sfyx = 0
      }
    })
  } else {
    type.value = types
    xfbfxxData.value.xfbxxInfoList.splice(index, 1)
  }
}

function pmsdeleteClick(val: any, types: any, index: any) {
  if (val.id) {
    type.value = types
    xfbfxxData.value.pmjxxInfoList.map((item: any, index: any) => {
      if (val.id == item.id) {
        item.sfyx = 0
      }
    })
  } else {
    type.value = types
    xfbfxxData.value.pmjxxInfoList.splice(index, 1)
  }
}
function pmbdeleteClick(val: any, types: any, index: any) {
  if (val.id) {
    type.value = types
    xfbfxxData.value.pmzbxxInfoList.map((item: any, index: any) => {
      if (val.id == item.id) {
        item.sfyx = 0
      }
    })
  } else {
    type.value = types
    xfbfxxData.value.pmzbxxInfoList.splice(index, 1)
  }
}

//重置
function removeClick(formEl: FormInstance | undefined) {
  if (!formEl) {
    return
  }
  formEl.resetFields()
  xfbfxxData.value.gwlx = sgoptions.value[0].zddm
  xfbfxxData.value.syzt = syztoptions.value[0].zddm
  xfbfxxData.value.ccxs = ccxsoptions.value[0].zddm
  xfbfxxData.value.sxlx = sxlxoptions.value[0].zddm
  xfbfxxData.value.lx = xhslxoptions.value[0].zddm
  xfbfxxData.value.jz = jzoptions.value[0].zddm
  xfbfxxData.value.xfsgwid = dataList.value[0].id
  xfbfxxData.value.xfpmgwid = pmsOptions.value[0].id
}
const requiredNameArrXfsgw = ['xfsgwmc', 'zgzj', 'gwlx', 'gwwyyl', 'gwgyyl']
const requiredNameArrXfpmgw = ['xfpmgwmc', 'zgzj', 'gwlx', 'gwwyyl', 'gwgyyl']
const requiredNameArrXfpf = ['xfbfmc', 'syzt']
const requiredNameArrXfpffzr = ['rymc', 'ryyddh', 'ryzbdh']
const requiredNameArrPmz = ['pmzmc', 'syzt']
const requiredNameArrXfsy = ['symc', 'ccxs', 'zdccrl']
const requiredNameArrTrsyqsd = ['symc', 'sxlx']
const requiredNameArrXhs = ['lx', 'jz', 'xfsgwid']
const requiredNameArrPms = ['lx', 'xfpmgwid']
const requiredNameArrGdsp = ['jz', 'xfsgwid']
const requiredNameArrGdpmp = ['jz', 'xfpmgwid']
//触发父组件更新
//保存
const submit = async (formEl: FormInstance | undefined) => {
  const reg = /^(([0-9]{0,4}))((\.{1}[0-9]{1,2}$)|$)/
  const regPhone =
    /^(?:(?:\+|00)86)?(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
  const regName = /^[\u4e00-\u9fa5]{2,5}$/
  const flag = false
  if (props.waterData.menuName == '消防水管网') {
    if (xfbfxxData.value.zgzj && !checkNumberTypeAndLength(xfbfxxData.value.zgzj, '主管管径', 6)) {
      return
    } else if (
      xfbfxxData.value.gwwyyl &&
      !checkNumberTypeAndLength(xfbfxxData.value.gwwyyl, '稳压压力', 6)
    ) {
      return
    } else if (
      xfbfxxData.value.gwgyyl &&
      !checkNumberTypeAndLength(xfbfxxData.value.gwgyyl, '高压压力', 6)
    ) {
      return
    }
  } else if (props.waterData.menuName == '消防泡沫管网') {
    if (xfbfxxData.value.zgzj && !checkNumberTypeAndLength(xfbfxxData.value.zgzj, '主管管径', 6)) {
      return
    } else if (
      xfbfxxData.value.gwwyyl &&
      !checkNumberTypeAndLength(xfbfxxData.value.gwwyyl, '稳压压力', 6)
    ) {
      return
    } else if (
      xfbfxxData.value.gwgyyl &&
      !checkNumberTypeAndLength(xfbfxxData.value.gwgyyl, '高压压力', 6)
    ) {
      return
    }
  } else if (props.waterData.menuName == '消防水源') {
    if (
      xfbfxxData.value.zdccrl &&
      !checkNumberTypeAndLength(xfbfxxData.value.zdccrl, '最大存储容量', 8)
    ) {
      return
    }
  }
  // for (const key in xfbfxxData.value.fzrxxInfo) {
  //   if (props.waterData.menuName == '消防泵房') {
  //     if (requiredNameArrXfpffzr.includes(key) && xfbfxxData.value.fzrxxInfo[key] == '') {
  //       console.log(key, '字段未填写')
  //       flag = true
  //     }
  //   }
  // }

  if (props.waterData.menuName == '消防泵房') {
    if (xfbfxxData.value.fzrxxInfo.rymc && !regName.test(xfbfxxData.value.fzrxxInfo.rymc)) {
      return ElMessage.warning('请输入2-5个的中文字符')
    } else if (
      xfbfxxData.value.fzrxxInfo.ryyddh &&
      !regPhone.test(xfbfxxData.value.fzrxxInfo.ryyddh)
    ) {
      return ElMessage.warning('请输入正确的手机号')
    }
  }

  //基本信息

  if (flag) {
    return (chemicalStore.FormCheckConfirmShow = true)
  }
  // chemicalStore.FormCheckConfirmShow = true
  // data.isShow = true
  xfbfxxData.value.xfbxxInfoList &&
    xfbfxxData.value.xfbxxInfoList.splice(xfbfxxData.value.xfbxxInfoList.length - 1, 1)
  xfbfxxData.value.pmjxxInfoList &&
    xfbfxxData.value.pmjxxInfoList.splice(xfbfxxData.value.pmjxxInfoList.length - 1, 1)
  xfbfxxData.value.pmzbxxInfoList &&
    xfbfxxData.value.pmzbxxInfoList.splice(xfbfxxData.value.pmzbxxInfoList.length - 1, 1)
  if (!formEl) {
    return
  }
  await formEl.validate((valid, fields) => {
    if (valid) {
      const factorInfo = chemicalStore.currentFactorInfo

      //获取要素名称
      let text: any = ''
      if (props.waterData.menuId === 'ys00103') {
        text = xfbfxxData.value.xfbfmc
      } else if (props.waterData.menuId === 'ys00104') {
        text = xfbfxxData.value.pmzmc
      } else if (props.waterData.menuId === 'ys00105' || props.waterData.menuId === 'ys00106') {
        text = xfbfxxData.value.symc
      }

      if (chemicalStore.fireFightingFacilities.dialogType === 'add') {
        //添加位置信息
        const wzxxId = xfbfxxData.value.wzxxbInfo.id
        xfbfxxData.value.wzxxbInfo = {
          id: wzxxId,
          qyid: qyId.value,
          bzmc: text,
          bzlx: factorInfo.bzlx,
          wzxx: JSON.stringify(factorInfo.wzxx),
          zxjd: factorInfo.zxdjdwd.lng,
          zxwd: factorInfo.zxdjdwd.lat,
          zxgd: factorInfo.zxdjdwd.alt,
          dibgd: 0,
          dingbgd: 0,
          sfyx: 1,
        }
      }

      saveData(props.waterData.menuId).then(({ cjId, mapIconUrl }: any) => {
        emit('updateList', false)
        emit('cancelClick')

        const overlayArr = ['ys00103', 'ys00104', 'ys00105', 'ys00106']
        const pointArr = ['ys00107', 'ys00108', 'ys00109', 'ys00110']

        //创建标牌
        if (overlayArr.includes(props.waterData.menuId)) {
          //新增
          if (chemicalStore.fireFightingFacilities.dialogType === 'add') {
            createOverlay({
              id: cjId,
              parentName: cjId,
              text,
              iconUrl: mapIconUrl,
              bzlx: factorInfo.bzlx,
              parentMenuId: props.waterData.parentId,
              pos: [factorInfo.wzxx.lng, factorInfo.wzxx.lat, factorInfo.wzxx.alt],
              attribute: {
                ...factorInfo.attribute,
                zxjd: factorInfo.wzxx.lng,
                zxwd: factorInfo.wzxx.lat,
                zxgd: factorInfo.wzxx.alt,
              },
            })
          }
          //修改
          else if (chemicalStore.fireFightingFacilities.dialogType === 'edit') {
            //如果是修改 先删除重复标牌
            window.GOverlay.removeByName(cjId)
            const wzxx = JSON.parse(xfbfxxData.value.wzxxbInfo.wzxx)
            createOverlay({
              id: cjId,
              parentName: cjId,
              text,
              iconUrl: mapIconUrl,
              bzlx: xfbfxxData.value.wzxxbInfo.bzlx,
              parentMenuId: props.waterData.parentId,
              pos: [wzxx.lng, wzxx.lat, wzxx.alt],
              attribute: xfbfxxData.value.wzxxbInfo,
            })
          }
        }
        //创建点
        else if (pointArr.includes(props.waterData.menuId)) {
          //新增
          if (chemicalStore.fireFightingFacilities.dialogType === 'add') {
            createPoint({
              id: cjId,
              parentName: cjId,
              iconUrl: mapIconUrl,
              bzlx: factorInfo.bzlx,
              pos: [factorInfo.wzxx.lng, factorInfo.wzxx.lat, factorInfo.wzxx.alt],
              attribute: {
                ...factorInfo.attribute,
                zxjd: factorInfo.wzxx.lng,
                zxwd: factorInfo.wzxx.lat,
                zxgd: factorInfo.wzxx.alt,
              },
            })
          }
        }
      })
    }
  })
}

async function saveData(menuId: any) {
  let cjId
  let mapIconUrl
  switch (menuId) {
    case 'ys00101':
      cjId = await upDatxfsgwxx(xfbfxxData.value)
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00102':
      cjId = await upDatxfpaomgw(xfbfxxData.value)
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00103':
      cjId = await upDateXfbfxx(xfbfxxData.value)
      mapIconUrl = xfbf_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00104':
      cjId = await upDatepmz(xfbfxxData.value)
      mapIconUrl = pmz_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00105':
      cjId = await upDatexfsy(xfbfxxData.value)
      mapIconUrl = xfsy_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00106':
      cjId = await upDatezrsy(xfbfxxData.value)
      mapIconUrl = trsy_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00107':
      cjId = await upDatxhs(xfbfxxData.value)
      mapIconUrl = xhs_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00108':
      cjId = await upDatpms(xfbfxxData.value)
      mapIconUrl = pms_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00109':
      cjId = await upDatgdsp(xfbfxxData.value)
      mapIconUrl = gdsp_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
    case 'ys00110':
      cjId = await upDatgdpmp(xfbfxxData.value)
      mapIconUrl = gdpmp_icon
      ElMessage.success('保存成功')
      data.isShow = false
      break
  }

  return { cjId, mapIconUrl }
}

const getmargin = () => {
  if (props.waterData.menuName == '消防泵房' || props.waterData.menuName == '泡沫站') {
    return 'file-text-margin'
  }
  return 'formdata-text-margin'
}

//获取水管类型
function querySglx() {
  queryZdZdmcInfo({ key: 'gwlx' }).then((res: any) => {
    sgoptions.value = res
    if (xfbfxxData.value.gwlx == '') {
      xfbfxxData.value.gwlx = sgoptions.value[0].zddm
    }
  })
}
// function queryblx() {
//   queryZdZdmcInfo({ key: 'blx' }).then((res: any) => {
//     blxoptions.value = res
//   })
// }
const formatBlxMc = (res: any) => {
  let str = ''
  props.blxoptions?.forEach((item: any) => {
    if (item.zddm == res.blx) {
      str = item.zdmc
    }
  })
  res.blx = str
}
const formatBlx = computed((res) => {
  return (res: any) => {
    let str = ''
    props.blxoptions?.forEach((item: any) => {
      if (item.zddm == res.blx) {
        str = item.zdmc
      }
    })
    return str
  }
})
// function querydlxs() {
//   queryZdZdmcInfo({ key: 'dlxs' }).then((res: any) => {
//     dllxoptions.value = res
//   })
// }
const formatDlxs = computed((res) => {
  return (res: any) => {
    let str = ''
    props.dllxoptions?.forEach((item: any) => {
      if (item.zddm == res.dlxs) {
        str = item.zdmc
      }
    })
    return str
  }
})
// function querysyms() {
//   queryZdZdmcInfo({ key: 'syms' }).then((res: any) => {
//     symsoptions.value = res
//   })
// }

const formatSyms = (res: any) => {
  let str = ''
  props.symsoptions?.forEach((item: any) => {
    if (item.zddm == res.syms) {
      str = item.zdmc
    }
  })
  return str
}
// const formatSyms = computed((res) => {
//   return (res: any) => {
//     let str = ''
//     symsoptions.value.forEach((item: any) => {
//       if (item.zddm === res.syms || item.zddm === res.syms.toString()) {
//         str = item.zdmc
//         }
//       })
//       return str

//   }
// })
function querysyzt() {
  queryZdZdmcInfo({ key: 'syzt' }).then((res: any) => {
    syztoptions.value = res
    if (xfbfxxData.value.syzt == '') {
      xfbfxxData.value.syzt = syztoptions.value[0].zddm
    }
  })
}
// function querypmblhhxs() {
//   queryZdZdmcInfo({ key: 'pmblhhqxs' }).then((res: any) => {
//     pmblhhoptions.value = res
//   })
// }
const formatPmblhhq = computed((res) => {
  return (res: any) => {
    let str = ''
    props.pmblhhoptions?.forEach((item: any) => {
      if (item.zddm == res.pmblhhqxs) {
        str = item.zdmc
      }
    })
    return str
  }
})
function queryccxs() {
  queryZdZdmcInfo({ key: 'ccxs' }).then((res: any) => {
    ccxsoptions.value = res
    if (xfbfxxData.value.ccxs == '') {
      xfbfxxData.value.ccxs = ccxsoptions.value[0].zddm
    }
  })
}
function querysxlx() {
  queryZdZdmcInfo({ key: 'sxlx' }).then((res: any) => {
    sxlxoptions.value = res
    if (xfbfxxData.value.sxlx == '') {
      xfbfxxData.value.sxlx = sxlxoptions.value[0].zddm
    }
  })
}
function queryxhslx() {
  queryZdZdmcInfo({ key: 'xhslx' }).then((res: any) => {
    xhslxoptions.value = res
    if (xfbfxxData.value.lx == '') {
      xfbfxxData.value.lx = xhslxoptions.value[0].zddm
    }
  })
}
function queryjz() {
  queryZdZdmcInfo({ key: 'xhsjz' }).then((res: any) => {
    jzoptions.value = res
    if (xfbfxxData.value.jz == '') {
      xfbfxxData.value.jz = jzoptions.value[0].zddm
    }
  })
}
function querysgwoption() {
  const params = {
    qyid: qyId.value,
  }
  queryxfsgwdd(params).then((res: any) => {
    dataList.value = res
    dataList.value.push({ id: '1', xfsgwmc: '无' })
    if (xfbfxxData.value.xfsgwid == '') {
      xfbfxxData.value.xfsgwid = dataList.value[0].id
    }
  })
}
function querypmsoption() {
  const params = {
    qyid: qyId.value,
  }
  queryxfpmgw(params).then((res: any) => {
    pmsOptions.value = res
    pmsOptions.value.push({
      id: '1',
      xfpmgwmc: '无',
    })
    if (xfbfxxData.value.xfpmgwid == '') {
      xfbfxxData.value.xfpmgwid = pmsOptions.value[0].id
    }
  })
}
onMounted(() => {
  querySglx()
  // queryblx()
  // querydlxs()
  // querysyms()
  querysyzt()
  // querypmblhhxs()
  queryccxs()
  querysxlx()
  queryxhslx()
  queryjz()
  querysgwoption()
  querypmsoption()
  if (props.lastxfs.xhsbh) {
    xfbfxxData.value.xfsgwid = props.lastxfs.xfsgwid
    xfbfxxData.value.lx = props.lastxfs.lx
    xfbfxxData.value.jz = props.lastxfs.jz
  } else if (props.lastpms.pmsbh) {
    xfbfxxData.value.xfpmgwid = props.lastpms.xfpmgwid
    xfbfxxData.value.lx = props.lastpms.lx
  } else if (props.lastgdsp.xhgdspbh) {
    xfbfxxData.value.xfsgwid = props.lastgdsp.xfsgwid
    xfbfxxData.value.jz = props.lastgdsp.jz
  } else if (props.lastgdpmp.xfgdpmpbh) {
    xfbfxxData.value.xfpmgwid = props.lastgdpmp.xfpmgwid
    xfbfxxData.value.jz = props.lastgdpmp.jz
  }
})
defineExpose({ xfbfxxData })
</script>

<style lang="less" scoped>
.fire-container {
  .input-required /deep/.el-form-item__label::before {
    padding-top: 1px !important;
  }
  // background-color: hotpink;
  .fire-main-container {
    width: 700px;
    border: 1px solid #0d609c;
    background: rgba(1, 7, 17, 0.7);
    position: fixed;
    top: 112px;
    right: 50%;
    // border: 8px solid rgba(255, 255, 255, 0.2);
    transform: translate(50%, 0);
    padding: 5px;
    box-sizing: border-box;
  }
  .fire-main {
    background: rgba(1, 7, 17, 0.8);
    color: rgba(255, 255, 255, 1);
    box-sizing: border-box;
    padding-bottom: 5px;

    z-index: 1 !important;
    .tablebox {
      /deep/ .el-input__wrapper {
        width: 110px;
      }
    }

    .card-item-title {
      margin-bottom: 15px;
      font-size: 20px;
      font-weight: 700;
      color: rgba(255, 255, 255, 1);
      // background-image: url('@/assets/image/card-item-title-bck.svg');
      background-size: 100% 100%;
      margin-left: 15px;
      background-repeat: no-repeat;
      position: relative;
    }
    .card-item-title::before {
      position: absolute;
      content: '';
      width: 6px;
      height: 20px;
      border-radius: 3px;
      background: #00ffff;
      left: -15px;
      top: 4px;
    }

    .form-title {
      width: 100%;
      height: 46px;
      border-bottom: 1px solid #797979;
      text-align: center;
      line-height: 46px;
      font-size: 24px;
      font-family: Microsoft YaHei;
      font-weight: bold;
      color: #fffefe;
    }

    .mingcheng /deep/ .el-input__wrapper {
      width: 533px;
    }

    .mingcheng1 /deep/ .el-input__wrapper {
      width: 612px;
    }

    .zdccmingcheng1 /deep/ .el-input__wrapper {
      width: 490px;
    }

    .mingcheng1 /deep/ .el-select .el-input__wrapper {
      width: 612px;
    }

    .personInCharge {
      margin-bottom: 30px;
    }

    .personInCharge /deep/ .el-input__wrapper {
      width: 109px;
    }

    /deep/.el-form-item__label {
      // font-size: 16px;
      color: rgba(255, 255, 255, 1);
    }

    .personInCharge /deep/ .el-form--inline .el-form-item {
      margin-right: 22px !important;
    }

    .zdcclbox /deep/ .el-input__wrapper {
      width: 160px;
    }

    .zdcclbox /deep/ .el-select .el-input__wrapper {
      width: 160px;
    }

    /deep/.el-input__inner {
      border: unset !important;
      color: rgba(255, 255, 255, 1);
    }

    /deep/.el-input__wrapper {
      border: 1px solid rgba(121, 121, 121, 1);
      box-shadow: unset;
      background-color: unset;
      box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color)) inset;
    }

    /deep/ .el-input__wrapper {
      width: 199px;
    }

    /deep/ .el-select .el-input__wrapper {
      width: 199px;
    }
    .pmjPump {
      /deep/ .el-input__wrapper {
        width: 100% !important;
      }

      /deep/ .el-select .el-input__wrapper {
        width: 100% !important;
      }
    }

    .firePump {
      position: relative;
      border: 1px solid #6d6d6d;
      border-top: 5px solid transparent;
      padding-top: 20px;
      border-bottom: none;

      .firePump-text {
        position: absolute;
        top: -3%;
        left: 50%;
        padding: 0 20px;
        display: block;
        font-size: 18px;
        font-family: Microsoft YaHei;
        font-weight: bold;
        color: #fffefe;
        transform: translate(-50%, -50%);
      }
      .firePump-text-left {
        position: absolute;
        left: 0px;
        top: -4px;
        width: 261px;
        height: 2px;
        background: #666666;
      }
      .firePump-text-right {
        position: absolute;
        top: -4px;
        right: 0px;
        width: 261px;
        height: 2px;
        background: #666666;
      }
      .firePump-text::b /deep/ .el-form-item {
        margin-bottom: 0px;
      }

      .el-form-item--default {
        margin-bottom: 0px;
      }

      ::v-deep .el-table th,
      ::v-deep .el-table tr,
      ::v-deep .el-table td {
        background: rgba(1, 7, 17, 0.8);
      }

      /deep/ .el-select .el-input__wrapper {
        width: 114px;
      }

      /deep/.el-table--enable-row-hover .el-table__body tr:hover > td {
        background: rgba(1, 7, 17, 0.8);
        /* color: #f19944; */
        /* 设置文字颜色，可以选择不设置 */
      }
    }

    .firePump /deep/ .el-form-item--default[data-v-2bba5325] {
      margin-bottom: 0px;
      width: 100px;
    }

    .xfsy /deep/ .el-form-item__label {
      width: 120px !important;
    }

    .xhskj /deep/ .el-form-item__label {
      padding: 0px 9px 0 0;
    }

    /deep/ .el-button {
      width: 140px;
      height: 30px;
    }

    /deep/ .el-table {
      background: rgba(1, 7, 17, 0.8);
    }
    /deep/.el-table__row {
      color: #fff;
    }
    /deep/ .el-table td,
    .el-table th.is-leaf {
      border-bottom: 1px solid #9aa1a4 !important;
    }
    /deep/.el-table__cell {
      border-bottom: 1px solid #9aa1a4 !important;
    }
    /deep/.el-table__inner-wrapper::before {
      height: 1px;
      background-color: #9aa1a4;
    }
  }

  .border-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    top: -32px;

    .border-left,
    .border-right {
      width: 38%;
      height: 3px;
      background-color: #666;
    }

    .border-content {
      width: 100px;
      text-align: center;
      color: rgba(255, 255, 255, 1);
    }
  }

  .sx-box /deep/ .el-select .el-input__wrapper {
    width: 490px;
  }
}
/deep/.el-form--inline {
  .el-form-item {
    margin-right: 28px;
  }
}
/deep/.el-table {
  .cell {
    padding: 0;
  }
}
.file-text-margin {
  margin-top: 10px !important ;
}
.formdata-text-margin {
  margin-top: 25px !important ;
}
.xfbffzr-title {
  position: relative;
}
.xfbffzr-title::before {
  position: absolute;
  content: '*';
  padding-top: 8px;
  color: rgba(254, 0, 0, 1);
  font-size: 24px;
  top: -10px;
  left: -10px;
}
</style>
